class Solution {
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
        unordered_set<int> hash(nums1.begin(), nums1.end());
        unordered_set<int> result;
        for (auto e : nums2)
        {
            if (hash.find(e) != hash.end())
                result.insert(e);
        }
        return vector<int>(result.begin(), result.end());
    }
};